/**
 * 
 */
package com.xbang.attendance.entity.order;

import java.io.Serializable;
import java.math.BigDecimal;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import com.xbang.attendance.entity.product.Product;

/**
 * @author dev.zhang
 * 
 */
@Entity
public class DeliveryDetails implements Serializable {

	private static final long serialVersionUID = 6823836222686056259L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer id;

	/** 送货单 */
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST }, fetch = FetchType.LAZY, targetEntity = DeliveryOrder.class)
	@JoinColumn(columnDefinition = "delivery_order", referencedColumnName = "id")
	private DeliveryOrder deliveryOrder;

	/** 产品 */
	@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY, targetEntity = Product.class)
	@JoinColumn(columnDefinition = "product", referencedColumnName = "id")
	private Product product;

	/** 产品数量 */
	private BigDecimal productNumber;

	/** 运送服务价格--服务费 */
	private BigDecimal serviceAmount;

	/**
	 * @return the id
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * @return the deliveryOrder
	 */
	public DeliveryOrder getDeliveryOrder() {
		return deliveryOrder;
	}

	/**
	 * @param deliveryOrder
	 *            the deliveryOrder to set
	 */
	public void setDeliveryOrder(DeliveryOrder deliveryOrder) {
		this.deliveryOrder = deliveryOrder;
	}

	/**
	 * @return the product
	 */
	public Product getProduct() {
		return product;
	}

	/**
	 * @param product
	 *            the product to set
	 */
	public void setProduct(Product product) {
		// this.setProductNumber(product.getProductCode());
		this.product = product;
	}

	/**
	 * @return the productNumber
	 */
	public BigDecimal getProductNumber() {
		return productNumber;
	}

	/**
	 * @param productNumber
	 *            the productNumber to set
	 */
	public void setProductNumber(BigDecimal productNumber) {
		this.productNumber = productNumber;
	}

	/**
	 * @return the serviceAmount
	 */
	public BigDecimal getServiceAmount() {
		return serviceAmount;
	}

	/**
	 * @param serviceAmount
	 *            the serviceAmount to set
	 */
	public void setServiceAmount(BigDecimal serviceAmount) {
		this.serviceAmount = serviceAmount;
	}

}
